using System;
using System.Collections.Generic;

using SMSSender.Entities.Utils;
using SMSSender.Entities.Models;
using SMSSender.DAL;
using SMSSender.Common;

namespace SMSSender.Biz
{
	public class MessageHistoryService
	{
		/// <summary>
		/// Saves a record to the MessageHistory table.
		/// </summary>
		public virtual void Insert(MessageHistoryInfo messageHistoryInfo)
		{
			try
			{
				new MessageHistoryDAO().Insert(messageHistoryInfo);
			}
			catch (Exception ex)
			{
				Logger.Error("SMSSender.Biz.MessageHistory - Insert", ex);
				throw;
			}

		}

		/// <summary>
		/// Saves a record to the MessageHistory table.
		/// </summary>
		public virtual void Update(MessageHistoryInfo messageHistoryInfo)
		{
			try
			{
				new MessageHistoryDAO().Update(messageHistoryInfo);
			}
			catch (Exception ex)
			{
				Logger.Error("SMSSender.Biz.MessageHistory - Update", ex);
				throw;
			}

		}

		/// <summary>
		/// Delete a record from the MessageHistory table.
		/// </summary>
		public virtual void Delete(Guid? idMessage)
		{
			try
			{
				new MessageHistoryDAO().Delete(idMessage);
			}
			catch (Exception ex)
			{
				Logger.Error("SMSSender.Biz.MessageHistory - Delete", ex);
				throw;
			}

		}

		/// <summary>
		/// Selects a single record from the MessageHistory table.
		/// </summary>
		public virtual MessageHistoryInfo Select(Guid? idMessage)
		{
			try
			{
				return new MessageHistoryDAO().Select(idMessage);
			}
			catch (Exception ex)
			{
				Logger.Error("SMSSender.Biz.MessageHistory - Select", ex);
				throw;
			}

		}

        /// <summary>
        /// Selects Top One records from the MessageHistory table.
        /// </summary>
        public virtual MessageHistoryInfo SelectTopOne()
        {
            try
            {
                return new MessageHistoryDAO().SelectTopOne();
            }
            catch (Exception ex)
            {
                Logger.Error("SMSSender.Biz.MessageHistory - SelectTopOne", ex);
                throw;
            }

        }

		/// <summary>
		/// Selects all records from the MessageHistory table.
		/// </summary>
		public List<MessageHistoryInfo> SelectAll()
		{
			try
			{
				return new MessageHistoryDAO().SelectAll();
			}
			catch (Exception ex)
			{
				Logger.Error("SMSSender.Biz.MessageHistory - SelectAll", ex);
				throw;
			}

		}

	}
}
